import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Regex {

    public static void main(String arg[]) {
        String content = "I am noob" + "from run_oob.com";

        String param = ".*run.*";

        boolean isMatch = Pattern.matches(param, content);
        String match = isMatch ? "yes" : "no";
        System.out.println("字符串中是否包含了 'runoob' 子字符串? " + match);

        // 按指定模式在字符串查找
        String line = "This order was placed for QT3000! OK?";
        String pattern = "(\\D*)(\\d+)(.*)";

        // 创建 Pattern 对象
        Pattern r = Pattern.compile(pattern);
        // 现在创建 matcher 对象
        Matcher m = r.matcher(line);
        if (m.find()) {
            System.out.println("Found value: " + m.group(0));
            System.out.println("Found value: " + m.group(1));
            System.out.println("Found value: " + m.group(2));
            System.out.println("Found value: " + m.group(3));
        } else {
            System.out.println("NO MATCH");
        }

        double large = max(10, 5);
        System.out.println(large);

        double test = max(9.1, 3.1);
        System.out.println(test);
    }

    public static int max(int num1, int num2) {
        return num1 > num2 ? num1 : num2;
    }

    public static double max(double num1, double num2) {
        if (num1 > num2)
            return num1;
        else
            return num2;
    }
}
